import time

import requests
from bs4 import BeautifulSoup

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
}
for i in range(1, 5):
    url = f'http://www.zishazx.com/product?page={i}&volum_start=0&volum_end=0&volum_id=0&price_start=0&price_end=0&category_id=0&pug_id=0&size_id=0&price_id=0&prize_id=0&search=&sflag='
    res = requests.get(url, headers=headers)
    # print(res.content.decode())
    soup = BeautifulSoup(res.content.decode(), 'lxml')
    # 查找当前ul class为list clearfix的所有儿子li
    li_list = soup.find('ul', class_="list clearfix").findAll('li')
    # print(li_list)
    for li in li_list:
        # 封面
        print(li.find('img')['src'])
        # 获取名称
        print(li.find('p', class_="name").string)
        # 获取编号
        print(li.find('p', class_="p_no").string)
    time.sleep(1)
    print(url, '抓取完成~~~~')

'''

http://www.zishazx.com/product?page=5&volum_start=0&volum_end=0&volum_id=0&price_start=0&price_end=0&category_id=0&pug_id=0&size_id=0&price_id=0&prize_id=0&search=&sflag=

http://www.zishazx.com/product?page=7&volum_start=0&volum_end=0&volum_id=0&price_start=0&price_end=0&category_id=0&pug_id=0&size_id=0&price_id=0&prize_id=0&search=&sflag=
'''